<?php
Zend::loadClass('Lead_EDO_Datatype_Numeric');

/**
 * Datatype for integer
 * 
 * @package EDO
 * @subpackage Datatypes
 *
 */
class Lead_EDO_Datatype_Integer extends Lead_EDO_Datatype_Numeric
{
	protected $_SQLValueIsQuoted = false;
	
	
	public function __toString()
	{
	    return '1';
	}
	
	
	
	public function validate($validate)
	{
		if(!$this->notNull() AND empty($validate) AND !is_numeric($validate))
    	   return null;
        
    	if(!is_numeric($validate))
			return false;
	    
	    if ((string)$validate !== (string)(int)$validate)
	       return false;

			
		
		if($validate < -2147483648 OR $validate > 2147483647)
			 return false;
		
		return $validate;			
	}
}